﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace SPN.Layouts.SPN.pages
{
    public partial class NewsletterView : LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SPWeb _Web = SPContext.Current.Web;
                //=============================================================================>>
                if (Request.QueryString["nid"] != null)
                {
                    int _Id = -1;
                    try { _Id = Convert.ToInt32(Request.QueryString["nid"].ToString()); }
                    catch { }
                    if (_Id > -1)
                    {
                        Entities.Newsletter _NewsletterItem = Common.Helper.GetNewsletterItem(_Web, _Id);
                        hf_ID.Value = _Id.ToString();
                        lab_Title.Text = _NewsletterItem.Title;
                        lab_Content.Text = _NewsletterItem.Content;
                    }
                    else { Response.Redirect("/_layouts/SPN/pages/Newsletter.aspx"); }
                }
                //=============================================================================>>
                hl_Cancel.NavigateUrl = _Web.Url + "/_layouts/SPN/pages/Newsletter.aspx";
            }
        }
    }
}
